package com.web;

import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.domain.Goods;
import com.service.GoodsService;
import com.service.Impl.GoodsServiceImpl;

@WebServlet("/likeServlet")
public class likeServlet extends HttpServlet{
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("进来了");
        String like = request.getParameter("Text");

        GoodsService goodsService = new GoodsServiceImpl();
        //查询相关商品
        List<Goods> likeGoods = goodsService.findLike(like);
        System.out.println(likeGoods);
        request.setAttribute("likeGoods", likeGoods);

        request.getRequestDispatcher("/page/indexPage.jsp").forward(request, response);
    }
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	}
}
